#include "FileLogger.h"
#include <Windows.h>
#include <cstdio>

FileLogger::FileLogger(const TCHAR* i_filename)
{
	if (_tfopen_s(&m_pFile, i_filename, TEXT("a+t")) != 0)
		m_pFile = NULL;
}

FileLogger::~FileLogger()
{
	if (m_pFile)
	{
		fclose(m_pFile);
	}
}

void FileLogger::log(const TCHAR* data)
{
	if (m_pFile)
	{
		_fputts(data, m_pFile);
		fflush(m_pFile);
	}
}
